Ext.define('HIT.view.MdataAccountPanel', {
    extend: 'Ext.grid.Panel',
    alias: 'widget.mdataaccountpanel',
    //销方银行账号
    cls: 'custom-grid',
    //frame: false,
    width: 1200,
    id: 'mdata-account-main-panel',
    //columnLines: false,
    store:'MdataAccountStore',
    layout:'fit',
    
    initComponent: function() {
        var me = this;
        
        Ext.applyIf(me, {
                 columns: [
                     {
                         xtype: 'rownumberer',
                         resizable: true,
                         width: 30
                     },
                     {
                         xtype: 'gridcolumn',
                         align: 'left',
                         style:'text-align:center;',
//                       flex:0.3,
                         width : 300,
                         dataIndex: 'pin_account_code',
                         text: Share.T('销方银行账号代码')
                     },
                     {
                         xtype: 'gridcolumn',
                         align: 'left',
                         style:'text-align:center;',
//                       flex:0.3,
                         width: 300,
                         dataIndex: 'pin_account',
                         text: Share.T('销方银行账号')
                     }
                 ],
                 viewConfig: {
                     //enableTextSelection:true
                 },
                 selModel: Ext.create('Ext.selection.CheckboxModel', {
                 	checkOnly: false
                 }), 
//                 plugins :[{ptype:"rowselectionpaging"}],
                 dockedItems: [
                               {
                                   xtype: 'pagingtoolbar',
                                   dock: 'bottom',
                                   inputItemWidth:45,
                                   id:'mdata-account-pag',
                                   width: 360,
                                   displayInfo: true,
                                   store: 'MdataAccountStore',
                                   plugins: [{
                                       ptype: "pagesize",
                                       uxPageSize: page_size}]
                               },{
               			    	xtype: 'toolbar',
            					dock: 'top',
            					items: [
            					    {
            					    	xtype: 'tbspacer',
            					          width: 20
            					    },
            					    {
            					    	xtype: 'textfield',
            					    	labelwidth:40,
            							width:234,
            					    	id: 'mdata-account-info-search',
            					    	fieldLabel: Share.T('信息查询'),
            					    	name: 'account-info-search',
            					    	listeners:{
        						    		specialkey : function(field, e) {  
        					                     if (e.getKey() == Ext.EventObject.ENTER) {  
//        					                        alert("回车事件");  
        					                    	Ext.getCmp('mdata-account-info-btn').fireEvent("click");
        					                     }  
        					                 }  
        						    	}
            					    },
            					    {
            					    	xtype: 'tbspacer',
            					          width: 20
            					    },
            					    {
            					    	xtype: 'button',
            					    	id:'mdata-account-info-btn',
            					    	text: Share.T('查询'),
            					    	listeners: {
            					    			click: {
            					    				fn: me.onMdataAccountInfoSearch,
            					                    scope: me
            					    			}
            					    	}
            					    }
            					]   	 
            			    }
                  ]
        });
        me.callParent(arguments);
    },
    onMdataAccountInfoSearch: function(btn,event,eOpts){
    	var searchInfo = Ext.getCmp('mdata-account-info-search').getValue();
    	var AccountStore = Ext.getCmp('tab-mdata-cancelaccount').getStore();
    	if(!searchInfo){
//    		Ext.MessageBox.alert("错误","查询框无信息");
//    		return;
    		AccountStore.load();
    	}else{
    		AccountStore.load({
    			params: {searchInfo:searchInfo},
    			callback: function(records, options, success){
    				if(!records[0] || !records){
    					Share.ShowMessage("I0051");
    				}
    			},
    		    scope: AccountStore,
    		    add: true
    		});
    	}
    }
    
});